UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U3HWy0S7f7i4DWz4UP7XL+Sz9d2mDg9pYeiPGdP77fI=' 
WHERE 
  key_id = 'a88366d5866c703b49273bfb6ae9e2b357dd1365ff1134162d896efa441019da' 
  AND (
    token = 'U3HWy0S7f7i4DWz4UP7XL+Sz9d2mDg9pYeiPGdP77fI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026