UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INartN4S8CskLOd5yCSceNvk+wJnjOVi+00HAc3l3GI=' 
WHERE 
  key_id = '11a2d47487afaead71d0215e0af7b591796d41ab261a8b1bbb85b2d3727e1f64' 
  AND (
    token = 'INartN4S8CskLOd5yCSceNvk+wJnjOVi+00HAc3l3GI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044