UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'llGx4JS6SdHICRjzSzj6LI9a2PIbgJ9wa2+pofPd4zM=' 
WHERE 
  key_id = '2307d694cc1b760c8549a9732556924784388816b277e3c70f4d1d6f6213f280' 
  AND (
    token = 'llGx4JS6SdHICRjzSzj6LI9a2PIbgJ9wa2+pofPd4zM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023