UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lI7Afsw41cC1p344tK6+VKAM2g5NsCj3PGEGxV7zt1w=' 
WHERE 
  key_id = 'e55f4986540c79cc66c155a4567498d592489ad466148a9195a9e3cace9cd38f' 
  AND (
    token = 'lI7Afsw41cC1p344tK6+VKAM2g5NsCj3PGEGxV7zt1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049