UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v+SnGMboLUDwYw8CbrigeByxkQnnwxFNRIdH89qhkcM=' 
WHERE 
  key_id = '79d146a0a7a5b7624df5899a3a964d99c67b3a00c1e444a51ba5fa8635dcc969' 
  AND (
    token = 'v+SnGMboLUDwYw8CbrigeByxkQnnwxFNRIdH89qhkcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018