UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ETsNIse0leu6U4JPQ8vJyxiagJ/zhHTrIm4jf4a2UuM=' 
WHERE 
  key_id = '300649f00cda6b7ca65800f6219203dd991b804381915dffc9b1dee5a0d973f5' 
  AND (
    token = 'ETsNIse0leu6U4JPQ8vJyxiagJ/zhHTrIm4jf4a2UuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00092