UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bg0MdoMMPeyJvGDHAI+S0qWBZTdMjlggZgrir2g+yl8=' 
WHERE 
  key_id = '2f888cb8b23e050f92ec571405bbafac376fe3f1ea7b40f7d82908a948f77758' 
  AND (
    token = 'bg0MdoMMPeyJvGDHAI+S0qWBZTdMjlggZgrir2g+yl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040