UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ulchcopAfMfB9D1NuLrV1XLiACuQ5tiRVrIY5mFBXSc=' 
WHERE 
  key_id = '50551a7ed1163e9a2ea5ae07b45132bfbfb073adb25edcf8ca9d342f6f99ffc4' 
  AND (
    token = 'ulchcopAfMfB9D1NuLrV1XLiACuQ5tiRVrIY5mFBXSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031