UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmpMBcVNZRv85U1gcXsI+nHFrXyEtFsODxtIidhLbJk=' 
WHERE 
  key_id = '3a4d0fbb78d6eebdf5e9a23e800e0025f18936a8a7d20304d0550986009eb419' 
  AND (
    token = 'qmpMBcVNZRv85U1gcXsI+nHFrXyEtFsODxtIidhLbJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034