UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JV9c3J1YFFr6OrBNURaxtFwOKEBHYcwg+aLqfjQaezc=' 
WHERE 
  key_id = '9ab456809b5be3ce09b462fd0133eba542b23bba8879edf365ee22e5b59e3955' 
  AND (
    token = 'JV9c3J1YFFr6OrBNURaxtFwOKEBHYcwg+aLqfjQaezc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017