UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3b6mz4GGpS3lU/j46Sp7CEQvTFV8WXuYEv2bJCrbQxM=' 
WHERE 
  key_id = '50873680864f5bf76c8a0a005688e231c35f7492ebcac31a1845b21d0701da7b' 
  AND (
    token = '3b6mz4GGpS3lU/j46Sp7CEQvTFV8WXuYEv2bJCrbQxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047