UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TXrehkwycF2+OFg2U6rnGiSLPp0xE3dws0XsyQ8uxXw=' 
WHERE 
  key_id = '0c9869f22e0169d3435370e57a50c4ce576030e15399128dfde0334ff32d44c3' 
  AND (
    token = 'TXrehkwycF2+OFg2U6rnGiSLPp0xE3dws0XsyQ8uxXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026