UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YSQ0U5+kOkqVL3mC4rQfShxjXSpPd+PkM4Sdr2oCbAY=' 
WHERE 
  key_id = '06c489a869ec16e5678b73563027fef19f11062bfc9ee359b0d71dbaea074af7' 
  AND (
    token = 'YSQ0U5+kOkqVL3mC4rQfShxjXSpPd+PkM4Sdr2oCbAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042