UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3RtpW3BHhhYRxr7bXEpy7+4bapAvjQPQLmijYkm520Q=' 
WHERE 
  key_id = '6d8f49f4b1a7683083a9f5e4ec918e7d116a312fced0cf16ed75cf751d2d78c8' 
  AND (
    token = '3RtpW3BHhhYRxr7bXEpy7+4bapAvjQPQLmijYkm520Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036