UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DLSwaATrsE8u1EbTHyOHY7BWH9PUX+b+Ae6JUSc78ko=' 
WHERE 
  key_id = '479ac50aa7773c0c0017ea8d97a1be44b0b9b5cfd894db4adc0771d72665b927' 
  AND (
    token = 'DLSwaATrsE8u1EbTHyOHY7BWH9PUX+b+Ae6JUSc78ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050