UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bNB9+ief3FZPFlObAwj4CUrqldA3xyaRMc7/I56qZsg=' 
WHERE 
  key_id = '24c58923c73538543d4b8773960ec61fe79020457fe6b786af79038a182afee7' 
  AND (
    token = 'bNB9+ief3FZPFlObAwj4CUrqldA3xyaRMc7/I56qZsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041