UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hS23o0MmpiQ76BF9h8LDMiuiUFxyNlmWWXm4jJ8CJto=' 
WHERE 
  key_id = '062c4aa3210a573e93f4b52715cf2e761d023a168a1bdd6b8d86db862d597103' 
  AND (
    token = 'hS23o0MmpiQ76BF9h8LDMiuiUFxyNlmWWXm4jJ8CJto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023