UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TUSENywmDC5j4L9wiwtK5IzYRYmq3CtBUj/g1cPVaHM=' 
WHERE 
  key_id = 'dbc54a800ba1088a05594c47ed6a57e1a138039513e797f2bc901cb60c82214a' 
  AND (
    token = 'TUSENywmDC5j4L9wiwtK5IzYRYmq3CtBUj/g1cPVaHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040