UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jZ7df3DXZmRqCLapkoNhN+5uoh6rVsjMtdRFt8Tkozw=' 
WHERE 
  key_id = '26cf84e97f41a07c614ddbc42d032e0911b76f63fd92e6715029b2d33fdd76a3' 
  AND (
    token = 'jZ7df3DXZmRqCLapkoNhN+5uoh6rVsjMtdRFt8Tkozw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037