UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+3sEw3j1yM2lcZB5o1y5kw0BaekfuZYZry/+qc24cg=' 
WHERE 
  key_id = '7a60983e403a84980f4b2426bd48223704e61fcd29345847f4df67d2c6932864' 
  AND (
    token = 'c+3sEw3j1yM2lcZB5o1y5kw0BaekfuZYZry/+qc24cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052