UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M86jSJ5UQfC5vjheOcfHSiWXq3LCX3oHv93EJtPRkkE=' 
WHERE 
  key_id = '6219d96a700707431727e62aae0331e2fe6167bfbd7a1f5eccb1775f33823828' 
  AND (
    token = 'M86jSJ5UQfC5vjheOcfHSiWXq3LCX3oHv93EJtPRkkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031