UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJpYvfyQBSZjYSVx29+QgCOYoa+hoT3+LLb8spGWCBY=' 
WHERE 
  key_id = '3f7716ebb853e687b430eaf26a1858524e42b5f0f228653649a1a8611b2e3896' 
  AND (
    token = 'nJpYvfyQBSZjYSVx29+QgCOYoa+hoT3+LLb8spGWCBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025