UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iKY2UqBkV8dLmUrCx9lA6rRVfHkoqrk7Of2ixTZkSUM=' 
WHERE 
  key_id = '11168a9e352a4392b299bc9de4776e4cf7b5e567c516f08b669843cf733a39c2' 
  AND (
    token = 'iKY2UqBkV8dLmUrCx9lA6rRVfHkoqrk7Of2ixTZkSUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048