UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PohzDZS2efi1m7/3FOGs1gJjTn+RKCx5P/qanonz2Wg=' 
WHERE 
  key_id = '45a6789928b2bfd5a123aea5e12e96777e44ee785a69654576778eb7345ea988' 
  AND (
    token = 'PohzDZS2efi1m7/3FOGs1gJjTn+RKCx5P/qanonz2Wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038