UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '15Ss9+7mws5s1N+oO8wMZQY59OvkdmM23rbdoT+56xc=' 
WHERE 
  key_id = 'c7235c19eec768003e0e8f6389ff0e6ca958a8b67c2bcc0aefbeee8c33b8166e' 
  AND (
    token = '15Ss9+7mws5s1N+oO8wMZQY59OvkdmM23rbdoT+56xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030