UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HC06WBT/+cN5plp3DmsvYlQcpraGXllOkvjaVhqU6Iw=' 
WHERE 
  key_id = '790839fee6038c39ed2cfffbab104c5b17c9daaf06b6d630d0fb78ee622ee108' 
  AND (
    token = 'HC06WBT/+cN5plp3DmsvYlQcpraGXllOkvjaVhqU6Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023