UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MuuaFt+f1w+tvM5DJWUmkhJDLneB4f+J6ktDH2qqQB4=' 
WHERE 
  key_id = '3dde9038584682fd086c1a4965ec437dc488cc741c22b36f265b4f557fdab6fa' 
  AND (
    token = 'MuuaFt+f1w+tvM5DJWUmkhJDLneB4f+J6ktDH2qqQB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024