UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T6XDFYvTmrFwTy2mCum8ehf6seAbrIjURalRFJWpXs8=' 
WHERE 
  key_id = '91f1a337bedce77f8e98c23f62f112870e63f2aa71850687658fb7f5449f186e' 
  AND (
    token = 'T6XDFYvTmrFwTy2mCum8ehf6seAbrIjURalRFJWpXs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034