UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BmW7AwDG9KIDxkMriLJYj6fyRDKLd9NRtBMtPcOsOcI=' 
WHERE 
  key_id = '226dd753b62b02ae7c057a61f4665a276d9466398fdf270226ba2350b0b2d06b' 
  AND (
    token = 'BmW7AwDG9KIDxkMriLJYj6fyRDKLd9NRtBMtPcOsOcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026