UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hF37I9XFM8bat8QD9QUqt7mHbeQTgPpP2v9gDhZ1lhk=' 
WHERE 
  key_id = '76adc2becab958e4c68d88aa7030c22cc39eeb6c7212d3092f1b7d9ed7d7a7a5' 
  AND (
    token = 'hF37I9XFM8bat8QD9QUqt7mHbeQTgPpP2v9gDhZ1lhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026