UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Re+BTBHpo1/YfvYGHfCjl6si2xOEUQ2h52WUmflcCPM=' 
WHERE 
  key_id = '790a27917347f4bf30ea7148cdd2b10d7dbc4ed8ddee488222cb48381f26b9dd' 
  AND (
    token = 'Re+BTBHpo1/YfvYGHfCjl6si2xOEUQ2h52WUmflcCPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039