UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FdYOO2fYcA6U+TLxEPSMw6ZxlMXP2eMO/Dre4oiLVjU=' 
WHERE 
  key_id = '477d18b7e5d7318c5f9b300ef456c37bd58835762135f3f50595e3f1acd28366' 
  AND (
    token = 'FdYOO2fYcA6U+TLxEPSMw6ZxlMXP2eMO/Dre4oiLVjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018