UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6+gRHFVXHlBZMirJiecUGxDJ0QQLtOuH1ckduK3+cc0=' 
WHERE 
  key_id = '161a5764be7f4dc3f884a9208873cae0461d92e74294d43f62999f5bceb15053' 
  AND (
    token = '6+gRHFVXHlBZMirJiecUGxDJ0QQLtOuH1ckduK3+cc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045