UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/0903DMTRj8xRXs3WlRD66/PGotyrxvASd+FJs/7jA=' 
WHERE 
  key_id = '2c692cdbd2ff4143184e0f406177011d0b1ee1021c8056c75abfd3cfc4dfa905' 
  AND (
    token = 'I/0903DMTRj8xRXs3WlRD66/PGotyrxvASd+FJs/7jA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028